﻿from django.contrib import admin
from FirstCheck.FirstCheck.models import *

class TaskAdmin(admin.ModelAdmin):
    list_display=('task_id','hj_drawing','task_remark')

admin.site.register(TaskTable,TaskAdmin)


@admin.register(InspectItem)
class InspectItemAdmin(admin.ModelAdmin):
    list_display=('inspect_id','inspect_name','used','frequency','gage')

    def processno_info(self,obj):
        return '%s' % obj.processno.processno
    processno_info.short_description='工序编号'

    

@admin.register(SpecTable)
class SpecTableAdmin(admin.ModelAdmin):
    list_display=('id','inspect','name','unit','standard_value','error_value','remark','markbit','task','process')

    def inspect_info(self,obj):
        return '%s'% obj.inspect.inspect_id
    inspect_info.short_description='检验项目编号'

@admin.register(ProcessTable)
class ProcessTableAdmin(admin.ModelAdmin):
    list_display=('processno','processname')

@admin.register(ProsedureSubtable)
class ProsedureSubTableAdmin(admin.ModelAdmin):
    list_display=('id','inspect_item_inspect','prosedure_table')

@admin.register(ProsedureTable)
class ProsedureTableAdmin(admin.ModelAdmin):
    list_display=('task','id','proc_seqnum','proc_num','pro_hjdrawing')


@admin.register(CheckRawdata)
class CheckRawdataAdmin(admin.ModelAdmin):
    list_display=('id','check_result','check_inspectno','check_prono',\
        'raw_data_info','spec_no','recorddate','check_type',\
       'task_id','mach_no','userid','username')


    def has_add_permission(self, request):
        #取消后台添加权限
        return False

    

@admin.register(SpecCheckresult)
class SpecCheckresultAdmin(admin.ModelAdmin):
    list_display=('spec_no','inspect_no','pro_no','task_no',\
       'qualifiedpercent','std_value','var_value','raw_checkdataid','recorddate')

    def has_add_permission(self, request):
        #取消后台添加权限
        return False

@admin.register(InspectCheckresult)
class InspectCheckresultAdmin(admin.ModelAdmin):
    list_display=('id','task_id','pro_no','inspect_no','isinspectpass','recorddate','remark')

    def has_add_permission(self, request):
        #取消后台添加权限
        return False

    
@admin.register(ProcessCheckresult)
class ProcedureCheckresultAdmin(admin.ModelAdmin):
    list_display=('id','taskid','procedure_no','isprocedurepass','recorddate','remark')

    def has_add_permission(self, request):
        #取消后台添加权限
        return False